
add_compile_options(-I ${CMAKE_CURRENT_SOURCE_DIR}/include/)

 add_executable(loader loader.S)
target_include_directories(loader PRIVATE ${PROJECT_SOURCE_DIR}/include)

add_executable(mbr mbr.S)

set_target_properties(mbr loader
  PROPERTIES
  SUFFIX .bin
  )

add_custom_command(
  TARGET mbr
  POST_BUILD
  COMMAND dd if=${EXECUTABLE_OUTPUT_PATH}/mbr.bin of=${PROJECT_SOURCE_DIR}/hd60M.img bs=512 count=1 conv=notrunc
  COMMENT "write mbr to hard desk"
  VERBATIM
  )

add_custom_command(
  TARGET loader
  POST_BUILD
  COMMAND dd if=${EXECUTABLE_OUTPUT_PATH}/loader.bin of=${PROJECT_SOURCE_DIR}/hd60M.img bs=512 count=3 seek=2 conv=notrunc
  COMMENT "write loader to hard desk"
  VERBATIM
  )

